package com.mg.framework.component;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.view.MotionEvent;

import com.mg.framework.kernel.Actor;
import com.mg.framework.kernel.Screen;
import com.mg.framework.kernel.ScreenFactory;
import com.mg.framework.kernel.Touchable;

public class StartGame extends Actor implements Touchable {

	public StartGame(Screen screen, Bitmap bitmap) {
		super(screen, bitmap);
		this.setX(this.screen.getXCenter() - bitmap.getWidth() / 2);
		this.setY(this.screen.getYCenter() - bitmap.getHeight() - 10);
	}

	@Override
	public void gameUpdate() {
		return;
	}

	@Override
	public void screenUpdate(Canvas canvas) {
		this.drawSelf(canvas, null);
	}

	@Override
	public void onTouchEvent(MotionEvent event) {
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
			ScreenFactory.changeScreen("logo");
			break;
		}
	}

	@Override
	public boolean isTouched(MotionEvent event) {
		if (event.getX() > this.getX() && event.getX() < this.getX() + this.width
				&& event.getY() > this.getY() && event.getY() < this.getY() + this.height) {
			return true;
		}
		return false;
	}
}